﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>树干树叶模式</title>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet"  type="text/css" />

    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>

    <script type="text/javascript" language="javascript" >
        //页面启动函数.
        $(function () {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopBranchesAndLeaf_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var i = mapExt.RetrieveFromDBSources(); //从数据库来查询.
            // alert(mapExt.Tag);
            //alert(mapExt.MyPK);

            if (mapExt.GetPara("SelectType") == "")
                mapExt.SetPara("SelectType", "1");


            if (mapExt.W <= 400)
                mapExt.W = 900;


            //mapExt.SetPara("SelectType", "1");
            //alert(i);

            //批量为复制.
            GenerFullAllCtrlsVal(mapExt);

            //基本属性.
            // $("#TB_Title").val(mapExt.GetPara("Title"));
            //p").val(mapExt.GetPara("SearchTip"));
            // $("#TB_RootTreeNo").val(mapExt.GetPara("RootNo")); //树的根节点编号.

            //设置按钮是否可以用?
            if (i == 0)
                $("#Btn_Delete").attr("disabled", true);
            else
                $("#Btn_Delete").removeAttr("disabled");
        });

        function Delete() {

            if (confirm('您确定要删除吗？') == false)
                return;

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopBranchesAndLeaf_" + GetQueryString("FK_MapData")+"_"+GetQueryString("KeyOfEn");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.
            mapExt.Delete();
            window.location.href = window.location.href;
        }

        function Save() {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopBranchesAndLeaf_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.

            mapExt.CopyURL();  //从url里面copy数据.
            mapExt.CopyForm(); //从from里面copy数据.

            //mapExt.SetPara("SearchTip", $("#TB_SearchTip").val());
            //mapExt.SetPara("RootNo", $("#TB_RootTreeNo").val()); //树的根节点编号.
            //var val= $("#DDL_SelectType").val();
            //alert(val);
            //mapExt.SetPara("SelectType", val); //选择类型.

            mapExt.ExtType = "PopBranchesAndLeaf";
            mapExt.AttrOfOper = GetQueryString("KeyOfEn");


            var err = "";

            if (mapExt.GetPara("Title") == "")
                err += '\t\n必填字段[标题]不能为空';

            if (mapExt.Tag1 == "")
                err += '\t\n必填字段[搜索数据源]不能为空';

            if (mapExt.Tag2 == "")
                err += '\t\n必填字段[左侧树列表数据源]不能为空';

            if (mapExt.Tag == "")
                err += '\t\n必填字段[数据列名与中文意思对照]不能为空';

            if (mapExt.DBType == "")
                err += '\t\n必填字段[数据源类型]不能为空';

            var val = mapExt.Save();

            // alert(val);
            window.location.href = window.location.href;
        }
    </script>
</head>
<body  >

<form id="cc">

<table id="Table1" style="width:99%;">
<caption>树干叶子模式</caption>

<tr>
<th colspan="2" >基本信息</th>
</tr>

<tr>
<td> <a href="javascript:ShowHidden('h_title')"> 标题</a>
<div id="h_title" style="color:Gray; display:none" >
<ul>
<li> 显示在窗口的文字，比如:</li>
<li> 搜索单据.</li>
<li> 选择人员.</li>
<li> 请选择接受人.</li>
</ul>
</div>
</td>

<td><input type="text" id="TBPara_Title" name="TBPara_Title" style="width:99%;" /> 
 
</td>
</tr>

<tr>
<td>弹窗属性</td>
<td >高度:<input type="text"  id="TB_H" name="TB_H" style="width:80px; text-align:right"  /> 宽度:<input type="text"  id="TB_W" name="TB_W" style="width:80px; text-align:right"  /> </td>
</tr>
 

<tr>
<td> <a href="javascript:ShowHidden('HSearch')"> 搜索提示</a>
<div id="HSearch" style="color:Gray; display:none" >

<ul>
<li> 显示在搜索文本框的背景文字，比如:</li>
<li> 请输入付款人名称,进行搜索.</li>
<li> 输入人员编号,名称，名称全拼,简拼关键字搜索.</li>
</ul>

</div>

</td>
<td><input type="text" id="TBPara_SearchTip" name="TBPara_SearchTip" style="width:90%;" /> 
</tr>

<tr>
<td>高级设置</td>
<td >

数据源类型
<select id="DDL_DBType" name="DDL_DBType">
<option value="0">执行SQL</option>
<option value="1">执行url返回JSON</option>
<option value="2">执行CCFromRef.js返回JSON</option>
</select> 

选择类型:
<input type="radio" id="RBPara_SelectType_0" name="RBPara_SelectType" value="0"  /> <label for="RBPara_SelectType_0">单选</label>
<input type="radio" id="RBPara_SelectType_1" name="RBPara_SelectType" value="1" /> <label for="RBPara_SelectType_1">多选</label>
  
 </td>
</tr>


<tr>
<th colspan="2">
<a href="javascript:ShowHidden('PopValSearchCond')">搜索数据源</a>
 <div id="PopValSearchCond" style="color:Gray; display:none">
 <ul>
 <li>点击关键字执行搜索返回的数据源</li>
 <li>比如:/DataUser/Handler.ashx?DoType=SearchEmps&Keyword=@Key @Key是关键字,是搜索的关键字.</li>
 </ul>
 </div>
</th>
</tr>
 

<tr>
<td colspan="2">
<textarea id="TB_Tag1" name="TB_Tag1" style="width:99%; height: 23px;">
</textarea>
</td>
 
</tr>



<!-- 左侧树列表数据源  -->
<tr>
<th colspan="2">
<a href="javascript:ShowHidden('tab2')">左侧树列表数据源</a>
 <div id="tab2" style="color:Gray; display:none">
 <ul>
 <li>设置一个可以返回json的数据源该数据源有No,Name,ParentNo三个约定的列. </li>
 <li>比如:/DataUser/Handler.ashx?DoType=ReqDepts</li>
 </ul>
 </div>
</th>
</tr>
 
<tr>
<td colspan=2>
<textarea id="TB_Tag2" name="TB_Tag2" style="width:99%; height: 23px;">
</textarea>
</td>
</tr>


<tr>
<td colspan=2>
 根目录树编号:<input id="TB_Doc"  name="TB_Doc" value="0"  style="width:250px;" type="text" />
  <a href="javascript:ShowHidden('h1')">帮助</a>
 <div id="h1" style="color:Gray; display:none">
   支持ccbpm的表达式,比如:@WebUser.FK_Dept , @FieldName
   </div>
</td>
</tr>
 
<!-- 右上列表信息数据源 ------------------------------------------------ -->
<tr>
<th colspan="2">
<a href="javascript:ShowHidden('tab4')">右上列表信息数据源(点左边树一个节点查询数据源)</a>
 <div id="tab4" style="color:Gray; display:none">
 <ul>
 <li>选择右边的树返回的详细信息列表数据源  </li>
 <li>比如:/DataUser/Handler.ashx?DoType=ReqEmpsByDeptNo&DeptNo=@Key @Key是关键字,是搜索的关键字.</li>
 </ul>
 </div>
</th>
</tr>
 

<tr>
<td colspan=2>
<textarea id="TB_Tag3" name="TB_Tag3" style="width:99%; height: 23px;">
</textarea>
</td>
</tr>


   <!-- 填充其他数据控件的数据源 -->
        <tr>
            <th colspan="4">
                <a href="javascript:ShowHidden('tabsT')">返回值填充其他数据控件的数据源</a>
                <div id="tabsT" style="color: Gray; display: none">
                    <ul>
                        <li>该数据源可以为空</li>
                        <li>如果配置了，系统就会按照配置数据源所返回的列与字段名相同的控件匹配进行赋值。</li>
                        <li>数据源必须包含@Key变量，并且当前模式为单选。</li>
                        <li>例如：SELECT No AS YuanGongBianHao, Name AS MingCheng, Tel AS DianHua, Email AS YouJian FROM port_emp WHERE No='@Key'</li>                      
                    </ul>
                </div>
            </th>
        </tr>
        <tr>
            <td colspan="4">
                <input id="TB_Tag4" name="TB_Tag4" style="width: 100%;" />
            </td>
        </tr>



<!-- 数据列名与中文意思对照  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-->

<tr>
<th colspan="2">
<a href="javascript:ShowHidden('tab6')">数据列名与中文意思对照</a>
 <div id="tab6" style="color:Gray; display:none">
 <ul>
 <li>该选项可以为空,在右上角的列表里查询或点树树干的数据源出现的列表,需要用中文显示列头.</li>
 <li>例如: No=编号,Name=名称,Addr=地址,Tel=电话,Email=邮件</li>
 </ul>
 </div>
</th>
</tr>
 
<tr>
<td colspan=2>
<input id="TB_Tag" name="TB_Tag" style="width:100%;" />
</td>
</tr>


<tr>
<td colspan=2><input type="button" value="保存"  id="Btn_Save" name="Btn_Save" onclick="return Save()" />
<input type="button" value="删除"  id="Btn_Delete" name="Btn_Delete" onclick="return Delete()" />
</td>
</tr>


</table>

 

</form>

</body>
</html>
